package com.gzk.hrm.feign;

import com.gzk.hrm.domain.Login;
import com.gzk.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class AuthLoginFeignFallBackFactory implements FallbackFactory<AuthLoginFeign> {
    @Override
    public AuthLoginFeign create(Throwable throwable) {
        return new AuthLoginFeign() {
            @Override
            public AjaxResult save(Login login) {
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setResultObj("保存Login信息失败！");
            }

            @Override
            public AjaxResult saveLoginMeal(Map<String, Object> map) {
                return AjaxResult.me().setSuccess(false).setResultObj("保存中间表失败！");
            }
        };
    }
}
